<?php
    class commentModel extends Model{
		//新闻留言管理的模型
		//查询是管理哪条新闻
		public function getchAll(){
			$id=$_GET['id'];
			$sql="select * from news where id='{$id}'";
		    return $this->db->fetchRow($sql);
		}
		//查询这条新闻的留言
		public function getAll(){
	      $pid=$_GET['id'];
		  $sr=$this->db->fetchAll("SELECT * FROM `news` WHERE pid='{$pid}'");
		  return $sr;
		}
		//删除新闻留言
		public function delete(){
			$id=$_GET['id'];
			$sql="DELETE FROM `news` WHERE id='{$id}'";
			$rs=$this->db->query($sql);
			return $rs;
		}
		//查询这条新闻的留言回复
		public function gethuihu(){
		  $ss=$this->db->fetchAll("SELECT * FROM `message`");
		  return $ss;
		}
		//删除新闻留言的回复
		public function dele(){
			$id=$_GET['id'];
			$sql="DELETE FROM `message` WHERE id='{$id}'";
			$rs=$this->db->query($sql);
			return $rs;
		}
	} 
?>